package com.gigi.datageniebackendmaster.config;


import com.gigi.datageniebackendmaster.mq.BiMqConstant;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMQConfig {


    @Bean
    public Exchange biExchange(){
        return new TopicExchange(BiMqConstant.BI_EXCHANGE_NAME, true, false);
    }

    @Bean
    public Queue biQueue(){
        return new Queue(BiMqConstant.BI_QUEUE_NAME, true, false, false);
    }

    @Bean
    public Binding biBinding(){
        return new Binding(BiMqConstant.BI_QUEUE_NAME, Binding.DestinationType.QUEUE,
                BiMqConstant.BI_EXCHANGE_NAME, BiMqConstant.BI_ROUTING_KEY, null);
    }


    @Bean
    public Exchange codeExchange(){
        return new DirectExchange("code_exchange", true, false);
    }

    @Bean
    public Queue codeQueue(){
        return new Queue("code_queue", true, false, false);
    }

    @Bean
    public Binding codeBinding(){
        return new Binding("code_queue", Binding.DestinationType.QUEUE,
                "code_exchange", "my_routingKey", null);
    }

}
